<template>
    <el-menu :default-active="$route.path"  text-color="black" active-text-color="#ffd04b"  :router="true" >
        <el-submenu  :index="item.index"  v-for="item in menuData"  :key="item.index">
            <template slot="title">  <i :class="item.icon"></i>
                <span>{{ item.title }}</span>
            </template>
            <el-menu-item :index="subItem.index"  v-for="subItem in item.subMenu"  :key="subItem.index" >
                {{ subItem.title }}
            </el-menu-item>
        </el-submenu>
    </el-menu>
</template>

<script>
export default {
    data() {
        return {
            menuData: [
                {
                    index: "1",
                    title: "管理员模块",
                    icon: "el-icon-user-solid",
                    subMenu: [
                        { index: "/adminsList", title: "管理员列表" },
                        { index: "/addAdmin", title: "新增管理员" },
                    ],
                    auth: 3,
                },
                {
                    index: "2",
                    title: "轮播图管理",
                    icon: "el-icon-s-platform",
                    subMenu: [
                        { index: "/swipersList", title: "轮播图列表" },
                        { index: "/addSwipers", title: "添加轮播图" },
                        // { index: "/updateSwipers", title: "修改轮播图" },
                        // { index: "/swipers", title: "轮播图其他操作" },
                    ],
                    auth: 3,
                },
                {
                    index: "3",
                    title: "菜谱管理",
                    icon: "el-icon-s-management",
                    subMenu: [
                        { index: "/menusList", title: "菜品展示" },
                        // { index: "/menusShow", title: "菜品详情" },
                        // { index: "/updateMenus", title: "修改菜品" },
                    ],
                    auth: 3,
                },
                {
                    index: "4",
                    title: "会员管理",
                    icon: "el-icon-s-opportunity",
                    subMenu: [
                        { index: "/membersLIst", title: "会员列表" },
                    ],
                    auth: 3,
                },
                {
                    index: "5",
                    title: "套餐管理",
                    icon: "el-icon-s-custom",
                    subMenu: [
                        { index: "/mealList", title: "套餐列表" },
                        { index: "/addMeal", title: "添加套餐" },
                    ],
                    auth: 3,
                },
                
            ],
        };
    },
    computed: {
        // authMenu() {
        //     const auth = this.$store.state.userInfo.auth;
        //     switch (auth) {
        //         case 1:
        //             return this.menuData.filter(
        //                 (item) => item.auth == 1 || item.auth == 3
        //             );
        //         case 2:
        //             return this.menuData.filter(
        //                 (item) => item.auth == 2 || item.auth == 3
        //             );
        //     }
        // },
    },
    methods: {},
};
</script>

<style scoped>
.el-menu {
    border-right: none;
    font-weight: 600;
    background-color: #ffdee9;
    background-image: linear-gradient(125deg, #ffdee9 0%, #b5fffc 100%);
}
</style>